<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang='zh-CN' xml:lang='zh-CN' xmlns='http://www.w3.org/1999/xhtml'>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta http-equiv="Content-Language" content="zh-CN"/>
        <meta name="robots" content="index, follow" />
        <link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico" />
        <title>改正过的-测试的知道- 氿上网</title>
        <?php echo $this->_var['system_css']; ?>
        <?php echo $this->_var['system_js']; ?>
        <script type="text/javascript">
            $(function(){
                $("#frm_reg").validate({
                    rules: {
                        username: {
                            required: true,
                            minlength: 6,
                            maxlength:20
                        },
                        password: {
                            required: true,
                            minlength: 6,
                            maxlength:20
                        },
                        confim_password: {
				required: true,
				minlength: 6,
                                maxlength:20,
				equalTo: "#password"
			},
                        email: {
                            required: true,
                            email: true
                        },
                        sex: "required",
                        province: "required",
                         captcha: "required"
                    
                    },
                    messages: {
                        username: {
				required: "用户名不能为空!",
				minlength: "必须大于6位小于20位!",
                                maxlength: "必须大于6位小于20位!"
			},
                        password: {
				required: "密码不能为空!",
				minlength: "必须大于6位小于20位!",
                                 maxlength: "必须大于6位小于20位!"
			},
                        	confim_password: {
				required: "密码确认不能为空",
				minlength: "必须大于6位小于20位!",
                                 maxlength: "必须大于6位小于20位!",
				equalTo: "和密码不一致!"
			},
                          email: {
				required: "邮箱不能为空!",
				email: "邮箱格式不正确!"
			},
                        sex: "请选择性别!",
                        province: "请选择所在地!",
                         captcha: "请输入验证码！"
                        
                    }
                });
            })
           
        </script>
        <script type="text/javascript">
            function reloadcode(){
                document.getElementById('captcha_change').src = '<?php echo $this->_var['site_url']; ?>captcha/default?r='+Math.random(); ;
            } 
        </script>
    </head>
    <body>

        <div id="OSC_Screen">
           <?php echo $this->fetch('header.html'); ?>

            <div id="OSC_Content" class='CenterDiv'>
                <?php echo $this->fetch('message.html'); ?>
                <div class="MainForm" id="reg_page">
                    <form id="frm_reg" name="frm_reg" action="<?php echo $this->_var['site_url']; ?>user/register" method="post" style="float:left; width:620px;">
                        <h2>加入氿上，已经加入的请点击<a href='<?php echo $this->_var['site_url']; ?>user/login'>这里</a>登录</h2>
                        <div id='error_msg' class='error_msg' style='display:none'></div>
                        <table cellspacing='0' cellpadding='0'>
                            <tr id='tr_user'>
                                <th >用户名：</th>
                                <td>
                                    <input type='text' name='username' id='username' value='' class='TEXT' style='width:200px;'/>
                                    <span id='password_msg'>* 6-20位</span>		
                                </td>    			
                            </tr>
                            <tr id='tr_email'>
                                <th>电子邮箱：</th>
                                <td>
                                    <input type='text' name='email' id='f_email' value='' class='TEXT' style='width:200px;'/>
                                </td>    			
                            </tr>
                            <tr>
                                <th>登录密码：</th>
                                <td><input type='password' name='password' id='password' class='TEXT' style='width:150px;'/>
                                    <span id='password_msg'>* 6-20位</span>		
                                </td>    		
                            </tr>
                            <tr>
                                <th>密码确认：</th>		
                                <td><input type='password' name='confim_password' id='f_pwd2' class='TEXT' style='width:150px;'/></td>
                            </tr>
                            <tr id='tr_gender'>
                                <th>性别：</th>		
                                <td>
                                    <input type='radio' name='sex' value='1' id='gender_1'/><label for='gender_1'>男</label>&nbsp;&nbsp;&nbsp;
                                    <input type='radio' name='sex' value='2' id='gender_2'/><label for='gender_2'>女</label>
                                    <span class='nodisp'>请选择性别</span>
                                </td>	
                            </tr>
                            <tr id='tr_area'>
                                <th>居住地区：</th>		
                                <td><select name="province" id="province_id">
                                        <option value=''>--请选择省份--</option> 
                                        <?php $_from = $this->_var['province']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'p');if (count($_from)):
    foreach ($_from AS $this->_var['p']):
?>
                                        <option value='<?php echo $this->_var['p']['id']; ?>'><?php echo $this->_var['p']['name']; ?></option>
                                        <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
                                    </select>
                                    <span id="sub_id"></span></td>
                            </tr>
                            <tr>
                                <th>验证码：</th>		
                                <td><input type='text' id='captcha' name='captcha' size='6' class='TEXT'/>
                                    <span><a href="javascript:reloadcode();">换另外一个图</a></span>
                                </td>
                            </tr>
                            <tr>
                                <th>&nbsp;</th>		
                                <td>
                                    <?php echo $this->_var['captcha']; ?>
                                </td>
                            </tr>
                            <tr class='buttons'>
                                <th>&nbsp;</th>		
                                <td style='padding:20px 0;'>
                                    <input type='submit' value=' 注册新用户 ' class='BUTTON SUBMIT'/><br/><br/>
                                </td>
                            </tr>
                        </table>
                    </form>
                    <div class='clear'></div>
                </div>

            </div>
            <div class='clear'></div></div>
        <div class='clear'></div>
     <?php echo $this->fetch('footer.html'); ?>
        </div>
        <script>
            $(function(){
                $('#province_id').change(function(){
                    $.ajax({
                        url:"<?php echo $this->_var['site_url']; ?>ajax/sub",
                        type:'post',
                        dataType:'html',
                        data:'id='+$(this).val(),
                        success:function(data){
                            if(data){
                                var html = "<select name='city'>";
                                html +=data+"</select>";
                                $('#sub_id').html(html);
                            }
                         
                        }
                    });
                });
            });
        </script>
    </body>
</html>
